<!DOCTYPE HTML>


<?php 
require_once'config.php';
require_once'functions.php';
$getQuestion = getQuestion($currentQuestion);
$studentID = $_SESSION['studentID'];

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{

	$num = $_POST['num'];
	$currentQuestion = $num;
	
	$_SESSION['score'] = $_POST['score']; 
	$score = $_SESSION['score'] ;
	}

$getQuestion = getQuestion($currentQuestion);

if ($getQuestion['type'] == "multiple-choice")
{
	$displayMC = "block";
	}
if ($getQuestion['type'] == "checkbox")
{
	$questionOptions = "questionOptions[]";
	$displayCB = "block"; 
		}
if ($getQuestion['type'] == "true-false")
{
	$displayTF = "block"; 
	}
?>
<html>
<head>
<script type="text/javascript" src="scripts/jquery-1.11.0.min.js"></script>
<script src="scripts/scripts.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=Cabin+Condensed' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="styles/styles.css" type="text/css" />
 <script type="text/javascript" src="scripts/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Formative Assessment</title>
</head>
<body onload="shuffle();">
<header>Learner Centred Design Formative Assessment<span class="loggedIn">Logged in as:<?php echo ucfirst($_SESSION['firstName']);?>&nbsp;&nbsp;<a href="logout.php">Logout</a></span></header>
<nav>
<?php include 'nav.php' ?>
</nav>
<div id="container" class="one-edge-shadow">
  <progress id='progress' value='<?php echo $currentQuestion ?>' max='11'>
    <?php echo $currentQuestion ?>
  </progress>
  <div id="mainContent">
  <div id="resource">
      <?php echo $getQuestion['resource'] ?>
    </div>
    <div id="quiz">
<form id="question" action="quizhandler.php" method="post" >
    <h2>Question
      <?php echo $getQuestion['questionID']; ?>
    </h2>
  
      <p class="itemStem">
        <?php echo $getQuestion['stem'] ?>
      </p>
   <div id = "qtypes">
    <div id="multiple-choiceQuestion" style="display:<?php echo $displayMC ?>">
      <div class="shufflyMC">
        <input name="<?php echo $questionOptions; ?>" id="inpMcRadio1" type="radio" value="<?php echo $getQuestion['option1'] ?>">
        <label id="lblMcRadio1" for="inpMcRadio1">
          <?php echo $getQuestion['option1'];?>
        </label>
      </div>
      <div class="shufflyMC">
        <input name="<?php echo $questionOptions; ?>" id="inpMcRadio2" type="radio" value="<?php echo $getQuestion['option2'] ?>">
        <label id="lblMcRadio2" for="inpMcRadio2">
          <?php echo $getQuestion['option2'] ?>
        </label>
      </div>
      <div class="shufflyMC">
        <input name="<?php echo $questionOptions; ?>" id="inpMcRadio3" type="radio" value="<?php echo $getQuestion['option3'] ?>">
        <label id="lblMcRadio3" for="inpMcRadio3">
          <?php echo $getQuestion['option3'] ?>
        </label>
      </div>
      <div class="shufflyMC">
        <input name="<?php echo $questionOptions; ?>" id="inpMcRadio4" type="radio" value="<?php echo $getQuestion['option4'] ?>">
        <label id="lblMcRadio4" for="inpMcRadio4">
          <?php echo $getQuestion['option4'] ?>
        </label>
      </div>
    </div>
    <div id="true-falseQuestion" style="display:<?php echo $displayTF ?>">
      <div class="shufflyTF">
        <input name="<?php echo $questionOptions; ?>" id="inpTfRadio1" type="radio" value="<?php echo $getQuestion['option1'] ?>">
        <label id="lblTfRadio1" for="inpTfRadio1">
          <?php echo $getQuestion['option1'];?>
        </label>
      </div>
      <div class="shufflyTF">
        <input name="<?php echo $questionOptions; ?>" id="inpTfRadio2" type="radio" value="<?php echo $getQuestion['option2'] ?>">
        <label id="lblTfRadio2" for="inpTfRadio2">
          <?php echo $getQuestion['option2'] ?>
        </label>
      </div>
 </div>
    </div>
    <div id="checkboxQuestion" style="display:<?php echo $displayCB ?>">
      <div class="shufflyCB">
        <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox1" type="checkbox"   value="<?php echo $getQuestion['option1'] ?>">
        <label id="lblCbCheckbox1" for="inpCbCheckbox1">
          <?php echo $getQuestion['option1'];?>
        </label>
      </div>
      <div class="shufflyCB">
        <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox2" type="checkbox"  value="<?php echo $getQuestion['option2'] ?>">
        <label id="lblCbCheckbox2" for="inpCbCheckbox2">
          <?php echo $getQuestion['option2'] ?>
        </label>
      </div>
      <div class="shufflyCB">
        <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox3" type="checkbox"  value="<?php echo $getQuestion['option3'] ?>">
        <label id="lblCbCheckbox3" for="inpCbCheckbox3">
          <?php echo $getQuestion['option3'] ?>
        </label>
      </div>
      <div class="shufflyCB">
        <input name="<?php echo $questionOptions; ?>" id="inpCbCheckbox4" type="checkbox"   value="<?php echo $getQuestion['option4'] ?>">
        <label id="lblCbCheckbox4" for="inpCbCheckbox4">
          <?php echo $getQuestion['option4'] ?>
        </label>
      </div>
    </div>
	<input type="hidden" name="attempt" value="<?php echo $attempt ?>">
	<input type="hidden" name="num" value="<?php echo $num ?>">
    <input type="hidden" name="score" value="<?php echo $score ?>">
    <input type="hidden" name="checkAnswer" value="TRUE">
    <input type="submit" id="submitAnswer" value="Check Answer" class="btn">
	</form>
    </div>
  </div>
      <div class="alert hidden">  
   </div>
    <p class='smiling'>Score:<?php echo $score ?></p>
    <p class='smiling'>Num:<?php echo $num ?></p>
    <p class='smiling'>Current Question:<?php echo $currentQuestion ?></p>
    <p class='smiling'>firstName:<?php echo $_SESSION['firstName']?></p>
    <p class='smiling'>score:<?php echo $_SESSION['score'];?></p>
    <p class='smiling'>attempt:<?php echo $_SESSION['attempt'];?></p>
    <p class='smiling'>username:<?php echo $_SESSION['username'];?></p>
    <p class='smiling'>id:<?php echo $_SESSION['studentID'];?></p>
	<p class='smiling'>Attempt: <?php echo $_SESSION['attempt'] ?> </p>
</div>
</body>
</html>